package org.example.consumer.factory;

import feign.hystrix.FallbackFactory;
import org.example.consumer.service.RemoteHelloService;
import org.example.consumer.service.RemoteHelloServiceFallbackImpl;
import org.springframework.stereotype.Component;

@Component
public class RemoteHelloServiceFallbackFactory implements FallbackFactory<RemoteHelloService> {

    @Override
    public RemoteHelloService create(Throwable throwable) {
        RemoteHelloServiceFallbackImpl remoteFallback = new RemoteHelloServiceFallbackImpl();
        remoteFallback.setCause(throwable);
        return remoteFallback;
    }
}